<?php
namespace app\api\controller;

use app\common\controller\Api;
//签到接口
class Signin extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = '*';

    public function index(){
        header('Access-Control-Allow-Origin: *');
        header('Access-Control-Allow-Credentials: true');
        header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
        header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
        $userInfo = $this->auth->getUserinfo();
        $house_id = $this->request->request("house_id");
        $res = db("yjy_signin")->insert([
            'user_id'   =>  $userInfo['id'],
            'house_id'  =>  $house_id,
            'createtime'=>  time()
        ]);
        if($res){
            $this->success("签到成功");
        }else{
            $this->error("签到失败");
        }
    }


}